﻿#include "ssConsole.h"
#include "../string/ssStrfunc.h"
#ifdef _WIN32
#include <windows.h>
#endif
#ifdef SS_USE_ANDROID
#include <android/log.h>
#define  LOG_TAG    "StarSeekerJni"
#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#endif


namespace StarSeeker
{

ssConsole* g_pConsole = new ssConsole();

void ssConsole::Print(const char *str)
{
#ifdef _WIN32
	OutputDebugStringA(">");
	OutputDebugStringA(str);
#elif defined SS_USE_ANDROID
	LOGI(">%s", str);
#else
	printf(">%s", str);
#endif
}

void ssConsole::Printf(const char *strf, ...)
{
	char tmpStr[1024] = {0};
	// 处理变长参数
	va_list arglist;
	va_start(arglist, strf);
	vsnprintf(tmpStr, 1024, strf, arglist);
	va_end(arglist);

	Print(tmpStr);
}

}
